# -*- coding:utf-8 -*-
# @Author    : g1879
# @date      : 2020/12/9
# @email     : g1879@qq.com
# @File      : 爬链家.py
from ListPage import ListPage

csspaths = {
    'rows': 'ul.sellListContent>li',
    'cols': {
        '标题': 'div.title>a',
        '信息': 'div.houseInfo'
    }
}
targets = {
    '标题': '标题',
    '链接': ('标题', 'href'),
    '信息': '信息'
}

url = 'https://sz.lianjia.com/ershoufang/luohuqu/pg1/'

p = ListPage(csspaths, url)
p.num_param = '/pg'
page_data = p('.page-box house-lst-page-box').attr('page-data')
p.pages_count = eval(page_data)['totalPage']

p.get_list(targets, count=2, wait=1)
